﻿using ComLib.ComType;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ComLib.ComType
{
    /// <summary>
    /// TCP客户端数据接收事件
    /// </summary>
    public delegate void DataReceivedEventHandler(object sender, DataReceivedEventArgs e);

    /// <summary>
    ///  TCP客户端数据接收事件结构定义
    /// </summary>
    public class DataReceivedEventArgs : EventArgs
    {
        public readonly string Message;
        public DataReceivedEventArgs(string msg)
        {
            this.Message = msg;
        }
    };

    public struct PromptInfo
    {  
        // 提示信息内容
        public string Text;

        // 是否以文字形式显示
        public bool TextEnabled;

        // 是否语音提示
        public bool VoiceEnabled;

        // 是否激发语音读完之后的事件
        public bool FireDoneEvent;

        public PromptInfo(string text, bool textEnabled = true, bool voiceEnabled = true, bool doneEvent = false)
        {
            Text = text;
            TextEnabled = textEnabled;
            VoiceEnabled = voiceEnabled;
            FireDoneEvent = doneEvent;
        }
    }

    /// <summary>
    /// 视频流中止事件
    /// </summary>
    public class LiveViewAbortedEventArgs : EventArgs
    {
        public readonly string Reason;

        public LiveViewAbortedEventArgs(string reason)
        {
            this.Reason = reason;
        }
    }
  

    public class UpdateTipBoardEventArgs : EventArgs
    {
        public readonly string strTip;
        public UpdateTipBoardEventArgs(string tip)
        {
            this.strTip = tip;
        }
    };

    /// <summary>
    /// 输入完成事件
    /// </summary>
    public class InputCompletedEventArgs : EventArgs
    {
        public readonly string PassportNumber;
        public InputCompletedEventArgs(string val)
        {
            this.PassportNumber = val;
        }
    };

    public class PhotographStatusUpdatedEventArgs : EventArgs
    {
        public readonly PhotographStatus Status;
        public readonly string Message;
        public PhotographStatusUpdatedEventArgs(PhotographStatus s, string m)
        {
            Status = s;
            Message = m;
        }
    }

    public class CountDownStartedEventArgs : EventArgs
    {
        public readonly int Count;
        public CountDownStartedEventArgs(int n)
        {
            this.Count = n;
        }
    };

    public class AddSpeakStringEventArgs : EventArgs
    {
        /// <summary>
        /// 多条
        /// </summary>
        public readonly List<PromptInfo> ListPrompts;
        /// <summary>
        /// 唯一
        /// </summary>
        public readonly PromptInfo StrValue;
        /// <summary>
        /// 是否多于一条
        /// </summary>

        public readonly bool bNotOnly;

        public AddSpeakStringEventArgs(List<PromptInfo> list)
        {
            this.ListPrompts = list;
            if (list != null && list.Count > 1)
            {
                this.bNotOnly = true;
            }
            else
            {
                this.bNotOnly = false;
            }
        }

        public AddSpeakStringEventArgs(PromptInfo strValue)
        {
            this.StrValue = strValue;
            this.bNotOnly = false;
        }
    };

    public class PackageSendEventArgs : EventArgs
    {
        /// <summary>
        /// 消息内容
        /// </summary>
        public readonly Package Package;
        public PackageSendEventArgs(Package value)
        {
            this.Package = value;
        }
    }

    public class ErrorReportedEventArgs : EventArgs
    {
        /// <summary>
        /// 消息内容
        /// </summary>
        public readonly string Message;
        public ErrorReportedEventArgs(string value)
        {
            this.Message = value;
        }
    }

    public class ExceptionReportedEventArgs : EventArgs
    {
        /// <summary>
        /// 异常内容
        /// </summary>
        public readonly Exception Exception;
        public ExceptionReportedEventArgs(Exception value)
        {
            this.Exception = value;
        }
    }
}
